<!-- 树形列表-示例模板 -->
<template>
<!-- 桩号选择 -->
  <div class="tree-list">
    <!-- 头部 -->
    <div class="top">
      <div class="top-left">
        <div class="tabs-title2">
          <span style="margin-left: 20px; color: #2e61d7; font-weight: bold"
            >数据</span
          >
        </div>
      </div>

      <div class="top-right">
        <div class="box1">
          <img src="@/assets/sub.png" alt="" />
          <span>全部收缩</span>
        </div>
        <div class="box2">
          <img src="@/assets/add.png" alt="" />
          <span>全部展开</span>
        </div>
        <div class="box3">
          <input class="ipt2" type="text" placeholder="输入项目编号" />
          <span
            >
            <img class="img" src="@/assets/search.png"
          />
          </span>
        </div>
      </div>
    </div>
    <!-- 内容 -->
    <div class="content">
      <div class="content-left">
        <div class="e-tree-file">
          <div class="name">包件名称</div>
          <input class="ipt" type="text" placeholder="输入项目编号" />
          <span>
            <img src="@/assets/search.png"/>
            </span>
          <el-tree
            :data="data"
            :props="defaultProps"
            @node-click="handleNodeClick"
          ></el-tree>
        </div>
      </div>
      <div class="content-right">
        <!-- 待选清单 -->
        <div class="e-tree-table">
          <el-table
            :data="tableData"
            style="width: 100%; margin-bottom: 20px"
            row-key="id"
            border
            default-expand-all
            :tree-props="{
              children: 'children',
              hasChildren: 'hasChildren',
            }"
          >
            <el-table-column prop="a" label="项目编号"> </el-table-column>
            <el-table-column prop="b" label="项目名称"> </el-table-column>
            <el-table-column prop="c" label="计量单位"> </el-table-column>
          </el-table>
        </div>
        <!-- 已选 -->
        <div class="tabs-title">
          <span style="margin-left: 20px; color: #2e61d7; font-weight: bold"
            >已选</span
          >
        </div>
        <div class="e-tree-table">
          <el-table
            :data="tableData"
            style="width: 100%; margin-bottom: 20px"
            row-key="id"
            border
            default-expand-all
            :tree-props="{
              children: 'children',
              hasChildren: 'hasChildren',
            }"
          >
            <el-table-column prop="a" label="项目编号"> </el-table-column>
            <el-table-column prop="b" label="项目名称"> </el-table-column>
            <el-table-column prop="c" label="计量单位"> </el-table-column>
          </el-table>
        </div>
      </div>
    </div>
    <!-- 底部 -->
    <div class="footer">
      <div class="left"></div>
      <div class="right">双击选择或取消数据
         <el-button type="mini">确定</el-button>
           <el-button type="mini" class="colse-btn">取消</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
    data () {
        return {
            data: [
                {
                    label: 'Lorem Ipsum1',
                    children: [
                        {
                            label: 'Lorem Ipsum1-1',
                            children: [
                                {
                                    label: 'Lorem Ipsum1-1-1',
                                },
                            ],
                        },
                    ],
                },
                {
                    label: 'Lorem Ipsum2',
                    children: [
                        {
                            label: 'Lorem Ipsum2-1',
                            children: [
                                {
                                    label: 'Lorem Ipsum2-1-1',
                                },
                            ],
                        },
                        {
                            label: 'Lorem Ipsum2-2',
                            children: [
                                {
                                    label: 'Lorem Ipsum2-2-1',
                                },
                            ],
                        },
                    ],
                },
                {
                    label: 'Lorem Ipsum3',
                    children: [
                        {
                            label: 'Lorem Ipsum3-1',
                            children: [
                                {
                                    label: 'Lorem Ipsum3-1-1',
                                },
                            ],
                        },
                        {
                            label: 'Lorem Ipsum3-2',
                            children: [
                                {
                                    label: 'Lorem Ipsum3-2-1',
                                },
                            ],
                        },
                    ],
                },
            ],
            defaultProps: {
                children: 'children',
                label: 'label',
            },
            tableData: [
                {
                    id: '1',
                    a: 'SDA1',
                    b: '直营经理部',
                    c: '1313',

                    children: [
                        {
                            id: '1-1',
                            a: 'SDA11  ',
                            b: '  四川川交路桥有限公司',
                            c: '2112',

                            children: [
                                {
                                    id: '1-1-1',
                                    a: 'SDA111',
                                    b: '四川公路桥梁集团建设有限公司',
                                    c: '2154',
                                },
                            ],
                        },
                    ],
                },
            ],
        }
    },
    components: {

    },
    methods: {
        handleNodeClick () {

        }
    },
}
</script>

<style lang="scss" scoped>
.tree-list {
  width: 80%;
  height: 80%;
  display: flex;
  margin: auto;

  flex-direction: column;
  padding-left: 20px;

  .top {
    height: 50px;
    line-height: 50px;
    display: flex;
    justify-content: space-between;
    .top-left {
      width: 100px;
      position: relative;
      .tabs-title2::before {
        content: "";
        height: 22px;
        width: 8px;
        border-radius: 40px;
        background-color: #2e61d7;
        display: block;
        position: absolute;
        left: 0px;
        top: 13px;
      }
    }
    .top-right {
      width: 400px;
      display: flex;
      justify-content: space-evenly;
      .box1 {
        flex: 1;

        line-height: 50px;
        img {
          width: 15px;
          height: 15px;
          margin-right: 10px;
          cursor: pointer;
        }
        span {
          color: #2e61d7;
          font-weight: bold;
          cursor: pointer;
        }
      }
      .box2 {
        flex: 1;

        line-height: 50px;
        img {
          width: 15px;
          height: 15px;
          margin-right: 10px;
          cursor: pointer;
        }
        span {
          color: #2e61d7;
          font-weight: bold;
          cursor: pointer;
        }
      }
      .box3 {
        flex: 1;

        line-height: 50px;
        img {
          width: 15px;
          height: 15px;
          margin-right: 10px;
          cursor: pointer;
        }
        span {
          color: #2e61d7;
          font-weight: bold;
          cursor: pointer;
        }
        .ipt2 {
          height: 23px;
          border-radius: 5px;
          margin-top: 15px;
          margin-bottom: 15px;
          margin-left: 12px;
          cursor: pointer;
          border: 1px solid #ccc;
        }
        .img {
          width: 15px;
          height: 15px;
          position: absolute;
          top: 20px;
          right: 120px;
          cursor: pointer;
        }
        ::placeholder {
          color: #cccc;
          padding-left: 10px;
        }
      }
    }
  }
  .content {
    flex: 1;
    display: flex;
    .content-left {
      width: 200px;
      height: 100%;
      border-radius: 5px;
      border: 1px solid #ccc;
      box-sizing: border-box;
      position: relative;
      .name {
        height: 40px;
        line-height: 40px;
        text-align: center;
        font-weight: 700;

        background-color: rgb(224, 231, 249);
      }
      .ipt {
        height: 30px;
        border-radius: 5px;
        margin-top: 15px;
        margin-bottom: 15px;
        margin-left: 12px;
        cursor: pointer;
        border: 1px solid #ccc;
      }
      img {
        width: 15px;
        height: 15px;
        position: absolute;
        top: 66px;
        right: 28px;
        cursor: pointer;
      }
      ::placeholder {
        color: #cccc;
        padding-left: 10px;
      }
    }
    .content-right {
      position: relative;
      flex: 1;
      margin-left: 10px;
      border-radius: 5px;
      // border: 1px solid #ccc;
      .tabs-title{
        margin-bottom: 20px;
        margin-top: 20px;
      }
      .tabs-title::before {
        content: "";
        height: 22px;
        width: 8px;
        border-radius: 40px;
        background-color: #2e61d7;
        display: block;
        position: absolute;
        left: 0;

      }
    }
  }
  .footer{
    height: 50px;
    display: flex;
    margin-top: 20px;
    background-color: rgb(239, 242, 246);
    .left{
      width: 65%;
      height: 50px;

    }
    .right{
      line-height: 50px;
      font-weight: 500;
      color: rgb(233, 84, 66);
      font-size: 14px;
    .colse-btn{
      background-color: #fff;
      color: #000;
    }
    }
    ::v-deep.el-button--mini{
      width: 60px;
      color: #fff;
      margin-left: 10px;
      background-color: rgb(46, 97, 215);
    }

  }

}

</style>
